//<<<<<<< HEAD
//package com.imay.live.fragment.load;
//
//import android.os.Bundle;
//import android.os.Handler;
//import android.os.Message;
//import android.text.TextUtils;
//import android.view.View;
//import android.widget.ImageView;
//
//import com.bumptech.glide.Glide;
//import com.imay.base.fragment.BaseFragment;
//import com.imay.live.helper.PreferenceHelper;
//import com.imay.live.view.ProgressWheel;
//import com.imay.live.R;
//
//
///**
// * Created by chan on 2017/3/24.
// */
//
//public class LoadFragment extends BaseFragment implements View.OnClickListener {
//
//    private int status; //1、开始图 2、封面女郎 3、其他
//    public static final int IN_RUNNING = 1001;
//    public static int END_RUNNING = 1002;
//    private long time; //总时长
//    private int pertime; // 每次滑动时长
//    private long progress; // 进度
//
////    private static RegisterCodeTimer mCodeTimer;
//
//    private ProgressWheel mProgressBar;
//
//    /**
//     * @param status  1、开始图 2、封面女郎 3、其他
//     * @param time    总时长
//     * @param pertime 每次滑动时长
//     * @return
//     */
//    public static LoadFragment newInstance(int status, long time, int pertime) {
//        LoadFragment load1Fragment = new LoadFragment();
//        Bundle bundle = new Bundle();
//        bundle.putInt("status", status);
//        bundle.putLong("time", time);
//        bundle.putInt("pertime", pertime);
//        load1Fragment.setArguments(bundle);
//        return load1Fragment;
//    }
//
//    @Override
//    protected int getLayoutId() {
//        return R.layout.fragment_load;
//    }
//
//    @Override
//    protected void initView(Bundle savedInstanceState) {
//        Bundle bundle = getArguments();
//        if (bundle != null) {
//            progress = 0;
//            status = bundle.getInt("status", -1);
//            time = bundle.getLong("time", -1);
//            pertime = bundle.getInt("pertime", -1);
//            if (initWidget() < 0) {
//                if (getActivity() instanceof LoadListener) {
//                    ((LoadListener) getActivity()).onLoaded(status, this);
//                }
//            } else {
//                start();
//            }
//        }
//    }
//
////    private void initListener() {
////        if (getActivity() instanceof LoadListener) {
////            ((LoadListener) getActivity()).initFragment(status, this);
////        }
////    }
//
//    /**
//     * 业务控件初始化
//     */
//    private int initWidget() {
//        // 某个参数为 -1 直接跳过业务
//        if (status == -1 || time == -1 || pertime == -1) {
//            return -1;
//        }
//
//        if (status == 1) {
//            mProgressBar = $(R.id.progressBar);
//            mProgressBar.setVisibility(View.INVISIBLE);
//        } else if (status == 2) {
//            String url = PreferenceHelper.getInstance().getString(PreferenceHelper.COVER_URL);
//            String url2 = getActivity().getIntent().getStringExtra(PreferenceHelper.COVER_URL);
//            if (TextUtils.isEmpty(url2) && url.equals(url2)) {
//                if (TextUtils.isEmpty(url)) {
//                    ImageView mImageView = $(R.id.iv_load);
//                    mImageView.setImageResource(R.mipmap.cover);
//                } else {
//                    $(R.id.iv_load).setVisibility(View.GONE);
//                    Glide.with(this).load(url).error(R.mipmap.cover).into((ImageView) $(R.id.iv_cover_girl));
//                }
//            } else {
//                $(R.id.iv_load).setVisibility(View.GONE);
//                Glide.with(this).load(url2).error(R.mipmap.cover).into((ImageView) $(R.id.iv_cover_girl));
//                PreferenceHelper.getInstance().putString(PreferenceHelper.COVER_URL, url2);
//            }
//            mProgressBar = $(R.id.progressBar);
//            mProgressBar.setVisibility(View.VISIBLE);
//            mProgressBar.setOnClickListener(this);
//        }
//        return status;
//    }
//
//    /**
//     * 开始计时
//     */
//    private void start() {
//        // loading开始返回
//        if (getActivity() instanceof LoadListener) {
//            ((LoadListener) getActivity()).onStart(status, this);
//        }
////        mCodeTimer = new RegisterCodeTimer(time, pertime, mCodeHandler);
////        mCodeTimer.start();
//        mCodeHandler.obtainMessage(IN_RUNNING).sendToTarget();
//
//    }
//
//    /**
//     * 设置封面
//     *
//     * @param url
//     */
//    public void setCoverGirl(String url) {
//    }
//
//    /**
//     * 倒计时Handler
//     */
//    Handler mCodeHandler = new Handler() {
//        public void handleMessage(Message msg) {
//            if (msg.what == IN_RUNNING) {// 正在倒计时
//                int pre = (int) ((pertime / (time + 0.0001f)) * 360);
//                if (status == 2) {
//                    if (mProgressBar.getProgress() < 360) {
//                        mProgressBar.incrementProgress(pre);
//                    }
//                }
//
//                progress += pre;
//                if (getActivity() instanceof LoadListener) {
//                    if (progress >= 360) {
//                        ((LoadListener) getActivity()).onLoaded(status, LoadFragment.this);
//                        return;
//                    } else {
//                        ((LoadListener) getActivity()).onLoading(status, progress, time, LoadFragment.this);
//                    }
//
//                }
//                mCodeHandler.sendEmptyMessageDelayed(IN_RUNNING, pertime);
//            }
//        }
//    };
//
//    @Override
//    public void onDestroy() {
//        super.onDestroy();
////        if (mCodeTimer != null) {
////            mCodeTimer.cancel();
//=======
////package com.imay.live.fragment.load;
////
////import android.os.Bundle;
////import android.os.Handler;
////import android.os.Message;
////import android.text.TextUtils;
////import android.util.Log;
////import android.view.View;
////import android.widget.ImageView;
////
////import com.bumptech.glide.Glide;
////import com.imay.base.fragment.BaseFragment;
////import com.imay.live.IMApplication;
////import com.imay.live.helper.PreferenceHelper;
////import com.imay.live.view.ProgressWheel;
////import com.imay.live.R;
////
////
/////**
//// * Created by chan on 2017/3/24.
//// */
////
////public class LoadFragment extends BaseFragment implements View.OnClickListener {
////
////    private int status; //1、开始图 2、封面女郎 3、其他
////    public static final int IN_RUNNING = 1001;
////    public static int END_RUNNING = 1002;
////    private long time; //总时长
////    private int pertime; // 每次滑动时长
////    private long progress; // 进度
////
//////    private static RegisterCodeTimer mCodeTimer;
////
////    private final String COVERGIRLURL = "covergirlurl";
////
////    private ProgressWheel mProgressBar;
////
////    /**
////     * @param status  1、开始图 2、封面女郎 3、其他
////     * @param time    总时长
////     * @param pertime 每次滑动时长
////     * @return
////     */
////    public static LoadFragment newInstance(int status, long time, int pertime) {
////        LoadFragment load1Fragment = new LoadFragment();
////        Bundle bundle = new Bundle();
////        bundle.putInt("status", status);
////        bundle.putLong("time", time);
////        bundle.putInt("pertime", pertime);
////        load1Fragment.setArguments(bundle);
////        return load1Fragment;
////    }
////
////    @Override
////    protected int getLayoutId() {
////        return R.layout.fragment_load;
////    }
////
////    @Override
////    protected void initView(Bundle savedInstanceState) {
////        Bundle bundle = getArguments();
////        if (bundle != null) {
////            progress = 0;
////            status = bundle.getInt("status", -1);
////            time = bundle.getLong("time", -1);
////            pertime = bundle.getInt("pertime", -1);
////            if (initWidget() < 0) {
////                if (getActivity() instanceof LoadListener) {
////                    ((LoadListener) getActivity()).onLoaded(status, this);
////                }
////            } else {
////                start();
////            }
//>>>>>>> 临时的启动页修改方案
////        }
////    }
////
//////    private void initListener() {
//////        if (getActivity() instanceof LoadListener) {
//////            ((LoadListener) getActivity()).initFragment(status, this);
//////        }
//////    }
////
////    /**
////     * 业务控件初始化
////     */
////    private int initWidget() {
////        // 某个参数为 -1 直接跳过业务
////        if (status == -1 || time == -1 || pertime == -1) {
////            return -1;
////        }
////
////        if (status == 1) {
////            mProgressBar = $(R.id.progressBar);
////            mProgressBar.setVisibility(View.INVISIBLE);
////        } else if (status == 2) {
////            String url = PreferenceHelper.getInstance().getString(COVERGIRLURL);
////            if (TextUtils.isEmpty(url)) {
////                ImageView mImageView = $(R.id.iv_load);
////                mImageView.setImageResource(R.mipmap.femian);
////            } else {
//////                Glide.with(this).load(url).error(R.mipmap.femian).into((ImageView) $(R.id.iv_cover_girl));
////
////            }
////            mProgressBar = $(R.id.progressBar);
////            mProgressBar.setVisibility(View.VISIBLE);
////            mProgressBar.setOnClickListener(this);
////        }
////        return status;
////    }
////
////    /**
////     * 开始计时
////     */
//////    private void start() {
//////        // loading开始返回
//////        if (getActivity() instanceof LoadListener) {
//////            ((LoadListener) getActivity()).onStart(status, this);
//////        }
////////        mCodeTimer = new RegisterCodeTimer(time, pertime, mCodeHandler);
////////        mCodeTimer.start();
//////        mCodeHandler.obtainMessage(IN_RUNNING).sendToTarget();
//////
//////    }
////
////    /**
////     * 设置封面
////     *
////     * @param url
////     */
////    public void setCoverGirl(String url) {
////        Glide.with(IMApplication.getInstance()).load(url).error(R.mipmap.femian).into(new ImageView(IMApplication.getInstance()));
////        PreferenceHelper.getInstance().putString(COVERGIRLURL, url);
////    }
////
////
////
////    @Override
////    public void onDestroy() {
////        super.onDestroy();
//////        if (mCodeTimer != null) {
//////            mCodeTimer.cancel();
//////        }
////
////    }
////
////
////}
